<?php
/**
 * Created by PhpStorm
 * User: honglin
 * Date: 2022/8/8
 * Time: 下午4:42
 */

namespace App\Listener\Ocean;

use App\Dao\Ocean\OceanTaskLogDao;
use App\Event\Ocean\OceanAd;
use App\Event\Ocean\OceanNavigateTo;
use App\Event\Ocean\OceanQuestion;
use App\Event\Ocean\OceanSignIn;
use App\Event\Ocean\OceanUserRubbishClear;
use App\WsService\SocketClientService;
use Hyperf\Event\Annotation\Listener;
use Hyperf\Event\Contract\ListenerInterface;

/**
 * @Listener()
 */
class OceanNavigateToListener implements ListenerInterface
{

    public function listen(): array
    {
        return [
            OceanNavigateTo::class,
        ];
    }

    /**
     * @param object $event
     * @return void
     */
    public function process(object $event)
    {
        /** @var OceanNavigateTo $event */
        $event = $event;
        $socketClientService = App(SocketClientService::class);

        $socketClientService->sendUserMessageV1($event->user_id, $event->event_name, $event->data);

    }
}